package com.hzeport.bgs22emduty.enums;

import com.hzeport.bgs22emduty.common.utils.StringUtils;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public enum SeTypeEnum {

    SHIFT_LEADER_G("1","带班关领导"),
    SHIFT_LEADER_C("2","带班处领导"),
    DUTY("3","值班"),
    AD_LEADER_S("4","署领导"),
    AD_LEADER_T("5","司局领导"),
    AD_LEADER_C("6","处领导"),
    AD_DUTY_MAIN("7","主值班员"),
    AD_DUTY_SUB("8","副值班员"),
    ;

    private String code;
    private String description;

    public String getCode() {
        return code;
    }

    public void setCode( String code ) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription( String description ) {
        this.description = description;
    }

    SeTypeEnum() {
    }

    SeTypeEnum( String code , String description ) {
        this.code = code;
        this.description = description;
    }

    public static String getDescByCode(String code) {
        if ( StringUtils.isNotEmpty(code)) {
            for (SeTypeEnum myEnum : SeTypeEnum.values()) {
                if (StringUtils.equals(myEnum.getCode(), code)) {
                    return myEnum.getDescription();
                }
            }
        }
        return "";
    }

    public static List<String> getAllAdminCode() {
        return Arrays.asList(SeTypeEnum.values()).stream().filter(i->Integer.parseInt(i.getCode())>3).map(i->i.getCode()).collect(Collectors.toList());
    }

    public static List<String> getAllSubCode() {
        return Arrays.asList(SeTypeEnum.values()).stream().filter(i->Integer.parseInt(i.getCode())<=3).map(i->i.getCode()).collect(Collectors.toList());
    }

    public static List<String> getAdminLeaderCode() {
        return Arrays.asList(SeTypeEnum.values()).stream().filter(i->Integer.parseInt(i.getCode())<=6&&Integer.parseInt(i.getCode())>3).map(i->i.getCode()).collect(Collectors.toList());
    }

    public static List<String> getAdminWorkerCode() {
        return Arrays.asList(SeTypeEnum.values()).stream().filter(i->Integer.parseInt(i.getCode())>6).map(i->i.getCode()).collect(Collectors.toList());
    }
}
